package common;

import java.io.Serializable;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Random;

public class User implements Serializable{

	/**
	 *
	 */
	private static final long serialVersionUID = 1L;
	
	private String username;
	
	private String password;
	
	private String ip;
	
	private int portDHT;
	
	private boolean online=false;
	
	public User(String user, String pass) throws UnknownHostException{
		
		this.username = user;
		this.password = pass;
		
		ip = InetAddress.getLocalHost().getHostAddress();
		
		Random randomGenerator = new Random();

		portDHT = randomGenerator.nextInt(65000);
		
	}
	
	public String getUserName(){
		
		return username;
		
	}
	
	public String getPassword(){
		
		return password;
		
	}
	
	public void setUserName(String user){
		
		this.username = user;
		
	}
	
	public void setPassword(String pass){
		
		this.password = pass;
		
	}
	
	public String getIP(){
		return ip;
	}
	
	public int getPortDHT(){
		return portDHT;
	}
	public void setOnline(boolean o){
		online=o;
	}
	public boolean getOnline(){
		return online;
	}

}
